<?php
include_once("../module/sns/config.php");

if($_GET['editid'] && is_numeric($_GET['editid'])){
	$sql = "select * from ".SNSPASTER." where id=".$_GET['editid']." limit 1";
	$db->query($sql);
	$de = $db->fetchRow();
}

if($_POST['act']=="save"){
	if($_POST['id'] && is_numeric($_POST['id'])){
		$sql = "update ".SNSPASTER." set pic='$_POST[pic]',status='$_POST[status]',name='$_POST[name]' where id='$_POST[id]'";
	}else{
		$sql = "insert into ".SNSPASTER." (name,pic,status,create_time) values('$_POST[name]','$_POST[pic]','$_POST[status]','".date("Y-m-d H:i:s",time())."')";
	}
	$db->query($sql);
	msg('?m=sns&s=sns_paster.php');
}

$tpl->assign('de',$de);
$tpl->assign('img_url_pre',$img_url_pre);
$tpl->display('sns_paster_edit_add.htm');